<{include file="home/head.tpl"}>
	 <div class="content_buss">
		<div class="logoin_title">
			<div class="loginimg"><img src="../public/img/logoin-img.jpg"/></div>
			<div class="login-text">&nbsp;&nbsp;会员登录 <i>User Login</i></div>
		</div>
		<div class="login-content">
			<div class="login-left">
				<table>
					<tr>
						<td>用户名：</td>
						<td>
							<input name="user_name" type="text" id="user" size="35" class="iptxt" />
						</td>
					</tr>
					<tr>
						<td>密码：</td>
						<td>
							<input name="pwd" type="password" id="pwd" size="35" class="iptxt" />
						</td>
					</tr>
					<tr>
						<td>验证码：</td>
						<td>						
							<div class="checkbox_data"><input name="check_code"  id="check_code" type="text"  size="4" class="iptxt" /></div>
							<div class="checkbox_img" >&nbsp;&nbsp;&nbsp;&nbsp;<img class="checkimg" src="checkcode.php" title="看不清，换一张" />&nbsp;&nbsp;&nbsp;&nbsp;</div>
							<div class="checkbox_exchange checkimg">换一张</div>
						</td>
					</tr>				
					<tr>
						<td style="height:40px;" colspan="2">
							<div class="login-button">登 录</div>							
						</td>
					</tr>
				</table>
			</div>
			<div class="login-right">
				<div class="login-right-title">有用户名吗</div>
				<div class="region-button"><a href="sign_up.php" target="_self" >注 册</a></div>
				<img src="../public/img/boat.png">
			</div>
		</div>
	</div>
<{include file="home/foot.tpl"}>
<script>
$(function(){

	 $(".login-button").click(function(){
		var user = $("#user").val();
		var pwd  = $("#pwd").val();
		var checkcode = $("#check_code").val();
		if(user != '' && pwd !='' && checkcode != '')
		{			
			 $.post(
                    'loginu.php',
                    {user:user,pwd:pwd,check_code:checkcode,act:'loginu'},
                    function(data){
                        if(data == 1 ){
                          alert('用户名或密码错误！')
                          changeCode()
                        }else if(data==2){
                            alert('验证码错误！');
                            changeCode()
                        }else if(data==3){
                            alert('该用户被禁用！');
                            changeCode()
                        }else if(data==99){
							 window.location.href ="index.php";
						}
                    },
                    'html'
                );
		}
		else
		{
			alert('请填写完整资料！')
		}
	 })

	 $(".checkimg").click(function(){
		$(".checkimg").attr('src','checkcode.php?id='+ Math.random())
	})
})

function changeCode(){
	$(".checkimg").attr('src','checkcode.php?id='+ Math.random())
}
</script>


